﻿/***********************************************************************
 * <copyright file="AccountingAuthRepository.cs" company="BSD JSC">
 * -->    Copyright (C) statement. All right reserved
 * </copyright>
 * 
 * Created:   Hoang Bich Son 
 * Email:    sonhb@newman.vn
 * Website:
 * Create Date: Friday, May 16, 2014
 * Usage: 
 * 
 * RevisionHistory: 
 * Date         Author               Description 
 * 
 * ************************************************************************/

using DxMvcApplication.AccountingServiceReference;
using DxMvcApplication.Repositories.Core;
using DxMvcApplication.Repositories.Core.Dictionary;

namespace DxMvcApplication.Repositories.Implementations
{
    /// <summary>
    /// AccountingAuthRepository class
    /// </summary>
    public class AccountingAuthRepository: AccountingRepositoryBase, IAccountingAuthRepository
    {
        /// <summary>
        /// Gets the token.
        /// </summary>
        /// <returns></returns>
        public string GetToken()
        {
            var request = new TokenRequest { RequestId = AccountingRequestHelper.RequestId, ClientTag = AccountingRequestHelper.ClientTag, UserName = AccountingRequestHelper.UserName };
            var response = AccountingServiceClient.GetToken(request);

            Correlate(request, response);

            return response.AccessToken;
        }
    }
}